﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TransFormer.BLL;

namespace TransFormer.Web.admin
{
    public partial class ProductTypeAdd : AdminPage
    {
        private BLL.ProductType _bll = new ProductType();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ModelList = _bll.GetModelList(string.Empty);
                parrentId.DataValueField = "Id";
                parrentId.DataTextField = "TypeName";
                parrentId.DataSource = ModelList;
                parrentId.DataBind();
            }

        }

        protected List<Model.ProductType> ModelList { get; set; }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            Model.ProductType pt = new Model.ProductType();
            pt.TypeName = txtTypeName.Text;
            pt.TypeDesc = txtDesc.Value;
            pt.ParrentId = int.Parse(parrentId.Value);
            pt.Language = language.Value;
            _bll.Add(pt);
            Response.Redirect("producttypelist.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

            Response.Redirect("producttypelist.aspx");
        }
    }
}